package com.yuncool;

import com.yuncool.constants.ResultCode;

import java.io.Serializable;

/**
 * @Auther XIE
 * @Date 2019/8/25 17:12
 * @Description 接口返回规范类
 * @Version 1.0
 * @param <T>
 *
 * resultCode:返回代码
 * resultMsg:返回消息
 * resultData:返回数据
 */
public class ServiceResult<T> implements Serializable {
    private String resultCode;
    private String resultMsg;
    private T resultData;

    /**
     * 默认成功
     */
    public ServiceResult() {
        this.resultCode = ResultCode.REQUEST_OK;
        this.resultMsg = ApiMessage.getMessage("MSG000");
    }

    /**
     * 调用失败
     * @param resultCode
     * @param resultMsg
     */
    public void setError(String resultCode,String resultMsg) {
        this.resultCode = resultCode;
        this.resultMsg = resultMsg;
    }

    public String getResultCode() {
        return resultCode;
    }

    public void setResultCode(String resultCode) {
        this.resultCode = resultCode;
    }

    public String getResultMsg() {
        return resultMsg;
    }

    public void setResultMsg(String resultMsg) {
        this.resultMsg = resultMsg;
    }

    public T getResultData() {
        return resultData;
    }

    public void setResultData(T resultData) {
        this.resultData = resultData;
    }
}
